home *** CD-ROM | disk | FTP | other *** search
- defineps drawHourMinuteFace(int hours; int mins; int width; int height; int hasColor)
- width 2 div 12 add % make (0,0) the center of it
- height 2 div 12 add
- translate
-
- 0.0 setgray % clear the background to black
- -140 -140 280 280 rectfill
- stroke
-
- 1 hasColor eq % draw the clock face
- {.333 .333 .5 setrgbcolor }
- {.333 setgray } ifelse
- 0.0 0.0 width 2.0 div 0.0 360.0 arc
- fill stroke
-
- 1 hasColor eq % and the 4 hashmarks....
- { .667 .333 .333 setrgbcolor }
- { 1.0 setgray } ifelse
- -.5 width mul 10 add
- -3.0
- 35.0
- 6.0
- rectfill
-
- .5 width mul 10.0 sub
- -3.0
- -35.0
- 6.0
- rectfill
-
- -3.0
- .5 height mul 10 sub
- 6.0 -35.0
- rectfill
-
- -3.0
- -.5 height mul 10 add
- 6.0
- 35.0
- rectfill
- stroke
-
-
- gsave
- 1 hasColor eq % minute hand
- { .667 1 1 setrgbcolor }
- { .667 setgray } ifelse
- 6.0 mins mul 180 sub rotate
- 2.0 setlinewidth
- -2.0 0.0 moveto
- -2.0 .4 height mul lineto
- 2.0 .4 height mul lineto
- 2.0 0 lineto
- stroke
- grestore
-
- 0.0 setlinewidth
-
- gsave
- 1 hasColor eq % hour hand
- { 0.0 0.0 .333 setrgbcolor }
- { 0.0 setgray } ifelse
- mins 60.0 div hours add 30.0 mul 180 add rotate
- -2.0 0.0 4.0 .25 height mul rectfill
- grestore
- stroke
- endps
-
- defineps drawSecond(int seconds; int width; int height; int hasColor)
- width 2 div 12 add
- height 2 div 12 add
- translate
-
- 0.0 setgray
- 6.0 seconds mul 180 sub rotate
- 0.0 setlinewidth
- 0.0 0.0 moveto
- 0.0 .45 height mul lineto
- stroke
-
- 0.0 .45 height mul 4.0 0.0 360.0 arc
- stroke
-
- 1.0 setgray
- 0.0 .45 height mul 2.0 0.0 360.0 arc
- fill
- stroke
- -6.0 seconds mul 180 add rotate
- endps
-